#include "MiniParaSurface.h"

using namespace XYF;

MiniParaSurface::MiniParaSurface(Func23 f, Real uLeft, Real uRight, Real vLeft, Real vRight)
    : m_f(f), m_uLeft(uLeft), m_uRight(uRight), m_vLeft(vLeft), m_vRight(vRight)
{
}

int MiniParaSurface::GetType()
{
    return MiniObject::para_surface;
}

Real MiniParaSurface::GetUBegin() const
{
    return m_uLeft;
}

Real MiniParaSurface::GetUEnd() const
{
    return m_uRight;
}

Real MiniParaSurface::GetVBegin() const
{
    return m_vLeft;
}

Real MiniParaSurface::GetVEnd() const
{
    return m_vRight;
}

Vector3f MiniParaSurface::SurfacePoint(Real u, Real v) const
{
    return m_f(u, v);
}

Vector3f MiniParaSurface::SurfaceParUPoint(Real u, Real v) const
{
    Real h = 1e-6;
    return (m_f(u + h, v) - m_f(u - h, v)) / (2 * h);
}

Vector3f MiniParaSurface::SurfaceParVPoint(Real u, Real v) const
{
    Real h = 1e-6;
    return (m_f(u, v + h) - m_f(u, v - h)) / (2 * h);
}
